/*
 * SGPquizzerView.java
 */

package sgpquizzer;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import java.util.Random;
import java.util.ArrayList;
/**
 * The application's main frame.
 */
public class SGPquizzerView extends FrameView {

    //creates the array of boxes
    ArrayList<QAPair> boxesArray = new ArrayList<QAPair>(10);

    public SGPquizzerView(SingleFrameApplication app) {
        super(app);

        initComponents();

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = SGPquizzerApp.getApplication().getMainFrame();
            aboutBox = new SGPquizzerAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        SGPquizzerApp.getApplication().show(aboutBox);
    }
    public void showInputBox() {
        if (InputBox == null) {
            JFrame mainFrame = SGPquizzerApp.getApplication().getMainFrame();
            InputBox = new InputBox(mainFrame);
            InputBox.setLocationRelativeTo(mainFrame);
        }
        SGPquizzerApp.getApplication().show(InputBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        skillLevel = new javax.swing.JSlider();
        jLabel1 = new javax.swing.JLabel();
        startQuiz = new javax.swing.JButton();
        questionAdd = new javax.swing.JButton();
        jFormattedTextField1 = new javax.swing.JFormattedTextField();
        jSeparator1 = new javax.swing.JSeparator();
        checkAnswer = new javax.swing.JButton();
        pairSelector = new javax.swing.JLabel();
        answerDisplayLabel = new javax.swing.JLabel();
        questionDisplayLabel = new javax.swing.JLabel();
        pairSelectorsSpinner = new javax.swing.JSpinner();
        questionDisplay = new javax.swing.JTextField();
        answerDisplay = new javax.swing.JTextField();
        quizQuestionDisplay = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sgpquizzer.SGPquizzerApp.class).getContext().getResourceMap(SGPquizzerView.class);
        mainPanel.setBackground(resourceMap.getColor("mainPanel.background")); // NOI18N
        mainPanel.setAutoscrolls(true);
        mainPanel.setMaximumSize(new java.awt.Dimension(517, 627));
        mainPanel.setName("mainPanel"); // NOI18N

        skillLevel.setBackground(resourceMap.getColor("skillLevel.background")); // NOI18N
        skillLevel.setForeground(resourceMap.getColor("skillLevel.foreground")); // NOI18N
        skillLevel.setMajorTickSpacing(1);
        skillLevel.setMaximum(5);
        skillLevel.setMinimum(1);
        skillLevel.setPaintLabels(true);
        skillLevel.setPaintTicks(true);
        skillLevel.setSnapToTicks(true);
        skillLevel.setToolTipText(resourceMap.getString("skillLevel.toolTipText")); // NOI18N
        skillLevel.setValue(1);
        skillLevel.setName("skillLevel"); // NOI18N
        skillLevel.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                skillLevelStateChanged(evt);
            }
        });

        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        startQuiz.setBackground(resourceMap.getColor("startQuiz.background")); // NOI18N
        startQuiz.setText(resourceMap.getString("startQuiz.text")); // NOI18N
        startQuiz.setName("startQuiz"); // NOI18N
        startQuiz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                startQuizActionPerformed(evt);
            }
        });

        questionAdd.setIcon(resourceMap.getIcon("questionAdd.icon")); // NOI18N
        questionAdd.setText(resourceMap.getString("questionAdd.text")); // NOI18N
        questionAdd.setName("questionAdd"); // NOI18N
        questionAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                questionAddActionPerformed(evt);
            }
        });

        jFormattedTextField1.setVisible(false);
        jFormattedTextField1.setText(resourceMap.getString("jFormattedTextField1.text")); // NOI18N
        jFormattedTextField1.setToolTipText(resourceMap.getString("jFormattedTextField1.toolTipText")); // NOI18N
        jFormattedTextField1.setName("jFormattedTextField1"); // NOI18N

        jSeparator1.setForeground(resourceMap.getColor("jSeparator1.foreground")); // NOI18N
        jSeparator1.setName("jSeparator1"); // NOI18N

        checkAnswer.setVisible(false);
        checkAnswer.setText(resourceMap.getString("Check Answer.text")); // NOI18N
        checkAnswer.setActionCommand(resourceMap.getString("checkAnswer.actionCommand")); // NOI18N
        checkAnswer.setName("Check Answer"); // NOI18N
        checkAnswer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkAnswerActionPerformed(evt);
            }
        });

        pairSelector.setText(resourceMap.getString("pairSelector.text")); // NOI18N
        pairSelector.setName("pairSelector"); // NOI18N

        answerDisplayLabel.setText(resourceMap.getString("answerDisplayLabel.text")); // NOI18N
        answerDisplayLabel.setName("answerDisplayLabel"); // NOI18N

        questionDisplayLabel.setText(resourceMap.getString("questionDisplayLabel.text")); // NOI18N
        questionDisplayLabel.setName("questionDisplayLabel"); // NOI18N

        pairSelectorsSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, 1000, 1));
        pairSelectorsSpinner.setToolTipText(resourceMap.getString("pairSelectorsSpinner.toolTipText")); // NOI18N
        pairSelectorsSpinner.setName("pairSelectorsSpinner"); // NOI18N

        questionDisplay.setEditable(false);
        questionDisplay.setText(resourceMap.getString("questionDisplay.text")); // NOI18N
        questionDisplay.setDragEnabled(false);
        questionDisplay.setName("questionDisplay"); // NOI18N
        questionDisplay.setOpaque(true);

        answerDisplay.setEditable(false);
        answerDisplay.setText(resourceMap.getString("answerDisplay.text")); // NOI18N
        answerDisplay.setName("answerDisplay"); // NOI18N

        quizQuestionDisplay.setVisible(false);
        quizQuestionDisplay.setEditable(false);
        quizQuestionDisplay.setFont(resourceMap.getFont("quizQuestionDisplay.font")); // NOI18N
        quizQuestionDisplay.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        quizQuestionDisplay.setText(resourceMap.getString("quizQuestionDisplay.text")); // NOI18N
        quizQuestionDisplay.setBorder(null);
        quizQuestionDisplay.setName("quizQuestionDisplay"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
                .addContainerGap(372, Short.MAX_VALUE)
                .addComponent(questionAdd)
                .addContainerGap())
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(36, 36, 36)
                        .addComponent(jLabel1))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(skillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(389, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
                .addGap(117, 117, 117)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 243, Short.MAX_VALUE)
                .addComponent(startQuiz)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
                .addContainerGap(139, Short.MAX_VALUE)
                .addComponent(pairSelectorsSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(49, 49, 49)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(answerDisplayLabel)
                    .addComponent(questionDisplayLabel)
                    .addComponent(questionDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(answerDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(118, 118, 118))
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addGap(112, 112, 112)
                .addComponent(pairSelector)
                .addContainerGap(256, Short.MAX_VALUE))
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addGap(127, 127, 127)
                .addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(131, Short.MAX_VALUE))
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(quizQuestionDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 481, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(30, Short.MAX_VALUE))
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addGap(190, 190, 190)
                .addComponent(checkAnswer)
                .addContainerGap(194, Short.MAX_VALUE))
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(questionAdd)
                .addGap(15, 15, 15)
                .addComponent(pairSelector)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(questionDisplayLabel)
                        .addGap(2, 2, 2)
                        .addComponent(questionDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(answerDisplayLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(answerDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(skillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(pairSelectorsSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(166, 166, 166)))
                .addGap(5, 5, 5)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(startQuiz)
                    .addComponent(jLabel2))
                .addGap(18, 18, 18)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(41, 41, 41)
                .addComponent(quizQuestionDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkAnswer)
                .addGap(44, 44, 44))
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(sgpquizzer.SGPquizzerApp.class).getContext().getActionMap(SGPquizzerView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutMenuItemActionPerformed(evt);
            }
        });
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setMaximumSize(new java.awt.Dimension(10000, 10000));
        statusPanel.setName("statusPanel"); // NOI18N
        statusPanel.setPreferredSize(new java.awt.Dimension(500, 72));

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 517, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 353, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>//GEN-END:initComponents

    private class QAPair{
       private String question;
       private String answer;
       public QAPair() {
           //not finished
       }
       QAPair temp = new QAPair();
    }
    private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed

    }//GEN-LAST:event_aboutMenuItemActionPerformed

    private void startQuizActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startQuizActionPerformed
        // TODO add your handling code here:
        quizQuestionDisplay.setVisible(true);
        checkAnswer.setVisible(true);
        jFormattedTextField1.setVisible(true);

        boxPick();

    }//GEN-LAST:event_startQuizActionPerformed

    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
        // TODO add your handling code here:
       
    }//GEN-LAST:event_exitMenuItemActionPerformed

    private void checkAnswerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAnswerActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkAnswerActionPerformed

    private void skillLevelStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_skillLevelStateChanged
        //What happens when you slide the skill slider
        int skillLeveller;
         skillLeveller = skillLevel.getValue();
         startingBox = skillLeveller;
    }//GEN-LAST:event_skillLevelStateChanged

    private void questionAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_questionAddActionPerformed
        // TODO add your handling code here:
        showInputBox();
    }//GEN-LAST:event_questionAddActionPerformed
    private int qPick() {
        
        int qPick = 3;
        return qPick;
    }
    private int boxPick() {
          
        Random arrayBoxPick = new Random();
           x = arrayBoxPick.nextInt(181);
           //Tests which box to get the question from 
           if (x<1){
             boxNumber = 10;
           }else{
               if (x<3){
                 boxNumber = 9;
               }else {
                  if (x<6){
                    boxNumber = 8;
                  }else{
                      if (x<11) {
                          boxNumber = 7;
                      }else{
                          if (x<19){
                              boxNumber = 6;
                          }else{
                              if (x<31){
                                  boxNumber = 5;
                              }else{
                                  if (x<49) {
                                      boxNumber = 4;
                                  }else{
                                      if (x<77){
                                          boxNumber = 3;
                                      }else{
                                          if (x<119){
                                              boxNumber = 2;
                                          }else
                                              boxNumber = 1;
                                          }
                                      }
                                  }
                              }
                          }
                      }
                  }
               }
    
            quizQuestionDisplay.setText("This Test Worked");
            answerDisplay.setText("this is ");
           qPick();
           return boxNumber;
    } //closes boxPick()
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField answerDisplay;
    private javax.swing.JLabel answerDisplayLabel;
    private javax.swing.JButton checkAnswer;
    private javax.swing.JFormattedTextField jFormattedTextField1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JLabel pairSelector;
    private javax.swing.JSpinner pairSelectorsSpinner;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JButton questionAdd;
    private javax.swing.JTextField questionDisplay;
    private javax.swing.JLabel questionDisplayLabel;
    private javax.swing.JTextField quizQuestionDisplay;
    private javax.swing.JSlider skillLevel;
    private javax.swing.JButton startQuiz;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    // End of variables declaration//GEN-END:variables

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
    private JDialog InputBox;

    private int startingBox, boxNumber, x;;

}
